[TOOLS] Fix check-script compatibility with non-bash shells.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 14 Dec 2006 16:00:31 +0000 (16:00 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 14 Dec 2006 16:00:31 +0000 (16:00 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/check/check_crypto_lib
tools/check/check_openssl_devel
tools/check/check_python_devel
tools/check/check_udev
tools/check/check_x11_devel

index 02e0d1821c0943b9e6086de20bebc798946c96dc..c7a2efbb49a342f14068624e3e4d61d4e250b8c7 100755 (executable)
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-BUILD CHECK-INSTALL
 
-function error {
-    echo
-    echo "  *** Check for crypto library FAILED"
-    exit 1
-}
+RC=0
 
 set -e
-ldconfig -p | grep -q libcrypto.so || error
+ldconfig -v 2>&1 | grep -q libcrypto.so || RC=1
+
+if test ${RC} -ne 0; then
+        echo
+        echo " *** Check for crypto library FAILED"
+fi
+
+exit ${RC}
index fe9d0106d7b327548beabb53fb5389ebd1465bda..c05a29dd8f3345f87ad89c3b434027b7c56baf46 100755 (executable)
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-BUILD
 
-function error {
-    echo
-    echo "  *** Check for openssl headers FAILED"
-    exit 1
-}
+RC=0
 
 set -e
-[ -e /usr/include/openssl/md5.h ] || error
+test -r /usr/include/openssl/md5.h || RC=1 
+
+if test ${RC} -ne 0; then
+       echo
+       echo " *** Check for openssl headers FAILED"
+fi
+
+exit ${RC}
index 1074f4cf073100288338fd7acfee640af0b60c4c..8ac361624a06c212dd31448f6ff44da01aa5505c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-BUILD
 
 function error {
@@ -7,10 +7,19 @@ function error {
     exit 1
 }
 
+RC=0
+
 python -c '
 import os.path, sys
 for p in sys.path:
        if os.path.exists(p + "/config/Makefile"):
                sys.exit(0)
 sys.exit(1)
-' || error
+' || RC=1 
+
+if test ${RC} -ne 0; then
+       echo
+       echo " *** Check for python development environment FAILED"
+fi
+
+exit ${RC}
index 2dd226ac467d904ca179584c391f8cc9d3a841e2..b9ae056ce26c32dd087ff4f665fcc636cf7c1397 100755 (executable)
@@ -1,16 +1,33 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-INSTALL
 
-function error {
-   echo
-   echo '  *** Check for udev/hotplug FAILED'
-   exit 1
-}
-[ -x "$(which udevinfo)" ] && \
-  UDEV_VERSION=$(udevinfo -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/')
+RC=0
 
-if [ -n "$UDEV_VERSION" ] && [ $UDEV_VERSION -ge 059 ]; then
-  exit 0
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+       TOOL="vnconfig"
+       which ${TOOL} 1>/dev/null 2>&1 || RC=1
+       ;;
+Linux)
+       TOOL="udevinfo"
+       test -x "$(which ${TOOL})" && \
+               UDEV_VERSION=$(${TOOL} -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/')
+       if test -n "${UDEV_VERSION}" -a ${UDEV_VERSION} -ge 059; then
+               RC=0
+       else
+               TOOL="hotplug"
+               which ${TOOL} 1>/dev/null 2>&1 || RC=1
+       fi
+       ;;
+*)
+       TOOL=""
+       echo "Unknown OS" && RC=1
+       ;;
+esac
+
+if test ${RC} -ne 0; then
+       echo
+       echo ' *** Check for ${TOOL} FAILED'
 fi
 
-which hotplug 1>/dev/null 2>&1 || error
+exit ${RC}
index 7154331000c395b84b063edb638e654dc5121616..722df86344d8d622abe3653125c7a9f6f1b852f1 100755 (executable)
@@ -1,11 +1,15 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-BUILD
 
-function error {
-    echo
-    echo "  *** Check for x11 headers FAILED"
-    exit 1
-}
+RC=0
 
 set -e
-[ -e /usr/include/X11/keysymdef.h ] || error
+test -r /usr/include/X11/keysymdef.h || \
+test -r /usr/X11R6/include/X11/keysymdef.h || RC=1
+
+if test ${RC} -ne 0; then
+       echo
+       echo " *** Check for x11 headers FAILED"
+fi
+
+exit ${RC}